# encoding: utf-8
# @File  : test01.py
# @Author: wu shaofan
# @Date  :  2024/04/17
# @Desc :
import os
import sys

from selenium import webdriver
import config
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
current_path = os.path.dirname(os.path.abspath(__file__))
print(current_path)
system_driver = sys.platform
print(system_driver)

driver_path = config.BASE_DIR + r'/tools/126.0.6478.57/chromedriver.exe'
# 创建 ChromeOptions 对象
options = Options()
options.add_experimental_option("excludeSwitches", ["enable-logging"])
options.add_argument("--headless")
# 创建 Chrome WebDriver 服务
service = Service(driver_path)
# 创建 Chrome WebDriver 实例
driver = webdriver.Chrome(service=service, options=options)

# 打开网页
driver.get("https://www.baidu.com")

print(driver.title)
driver.quit()